

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <title>登录页面 - {:config('WEB_SITE_TITLE')}代理管理系统</title>
    <link rel="shortcut icon" href="/static/admin/css/favicon.ico"/>
    <meta name="keywords" content="{:config('WEB_SITE_TITLE')}代理管理系统">
    <meta name="description" content="{:config('WEB_SITE_TITLE')}代理管理系统">
    <meta name="author" content="yinqi">
    <link href="/static/logibys/bootstrap.min.css" rel="stylesheet">
    <link href="/static/logibys/style.min.css" rel="stylesheet">
    <style>
        .login-form .has-feedback {
            position: relative;
        }

        .login-form .has-feedback .form-control {
            padding-left: 36px;
        }

        .login-form .has-feedback .mdi {
            position: absolute;
            top: 0;
            left: 0;
            right: auto;
            width: 36px;
            height: 36px;
            line-height: 36px;
            z-index: 4;
            color: #dcdcdc;
            display: block;
            text-align: center;
            pointer-events: none;
        }

        .login-form .has-feedback.row .mdi {
            left: 15px;
        }
    </style>
</head>

<body class="center-vh" style="background-image: url(/static/images/c40e29813c867daf5df93a3a228178f4f4619d98.jpg@942w_480h_progressive.webp);background-size:100% 100%; background-size: cover;">
<div class="card card-shadowed p-5 w-420 mb-0 mr-2 ml-2" style="border-radius: 30px">
    <div class="text-center mb-3">
        <a href="index.html" style="color: #DAA520"> <h2 style="font-weight:bold;font-size:30px;">{:config('WEB_SITE_TITLE')}</h2></a>
    </div>

    <form action="#!" method="post" class="login-form">
        <div class="form-group has-feedback">
            <span class="mdi mdi-account" aria-hidden="true"></span>
            <input type="text" class="form-control" id="username" placeholder="用户名">
        </div>

        <div class="form-group has-feedback">
            <span class="mdi mdi-lock" aria-hidden="true"></span>
            <input type="password" class="form-control" id="password" placeholder="密码">
        </div>

        <div class="form-group has-feedback row">
            <div class="col-7">
                <span class="mdi mdi-check-all form-control-feedback" aria-hidden="true"></span>
                <input type="text" name="captcha" id="captcha" class="form-control" placeholder="验证码">
            </div>
            <div class="col-5 text-right">
                <!--<canvas width="100" height="40" id="verifyCanvas"></canvas>-->
                <!--<img id="code_img">-->
                <img src="/daili/login/checkverify.html" id="yzm" onclick="javascript:this.src='/daili/login/checkverify.html?tm='+Math.random();" style="float:right;cursor: pointer"/> 
            </div>
        </div>

        <div class="form-group" style="background-color: #DAA520;border:1px solid #DAA520;">
            <a class="btn btn-block btn-primary" onclick="login()" style="background-color: #DAA520;border-color: #DAA520">立即登录</a>
        </div>
    </form>

    <p class="text-center text-muted mb-0" style="color: #DAA520">Copyright © 2022 <a href="http://cclhl.top" style="color: #DAA520">{:config('WEB_SITE_TITLE')}</a></p>
</div>

<script type="text/javascript" src="/static/logibys/jquery.min.js"></script>

<script type="text/javascript" src="/static/logibys/bootstrap-notify.min.js"></script>
<script type="text/javascript">
    if (window.top != window.self) {
        window.top.location.href = window.self.location.href;
    }
    function JTrim(s) {
        if (s == "") return "";
        return s.replace(/(^\s*)|(\s*$)/g, "");
    }

    $(function () {
        document.getElementById("username").focus();
        $("#username").keydown(function (event) {
            if (event.keyCode == 13) {
                login()
            }
        });
        $("#password").keydown(function (event) {
            if (event.keyCode == 13) {
                login()
            }
        })
        $("#captcha").keydown(function (event) {
            if (event.keyCode == 13) {
                login()
            }
        })
    });

    function login() {
        var username = $("#username").val();
        var password = $("#password").val();
        var captcha = $("#captcha").val();
        if (JTrim(username) == "" || JTrim(password) == "") {
            funnotify("账号或密码不能为空", "warning")
            return;
        }
        if (JTrim(captcha) == "") {
            funnotify("请输入验证码", "warning")
            return;
        }
        
        var data = {};
        data.username = username;
        data.password = password;
        data.code     = captcha;
        $.ajax({
            type: 'POST',
            url: "/daili/login/dologins.html",
            contentType: "application/json",
            data: JSON.stringify(data),
            success: function (result) {
                
                if (result.code == 1) {
                    funnotify(result.msg, "success");
                    // 登录成功
                    window.location = result.url;
                }else{
                    
                    /*根据后台传过来的错误提示用户*/
                    funnotify(result.msg, "danger");
                    $("#yzm").click();
                }
            },
            error: function (result) {
                funnotify("网络异常!", "danger");
            },
        });
    }
    function funnotify(msg, type){
        $.notify({
                icon: 'mdi mdi-alert',
                message: msg,
            }, {
                type: type,
                z_index: 99999,
                allow_dismiss: false,//显示删除按钮
                placement: {
                    from: "top",
                    align: "center"
                },
                delay: 1000
            }
        )
    }
</script>
</body>
</html>